package com.sense.kukoo.common.wiget.adapter.viewholder;

import android.util.SparseArray;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

public class BaseViewHolder extends RecyclerView.ViewHolder {
    /**
     * Views indexed with their IDs
     */
    private SparseArray<View> mViews = new SparseArray<>();

    public BaseViewHolder(@NonNull View itemView) {
        super(itemView);
    }

    public View getView(int viewId){
        View view = mViews.get(viewId);
        if (view == null){
            View v = itemView.findViewById(viewId);
            mViews.put(viewId,v);
            return v;
        }else{
            return view;
        }
    }
}
